﻿<Page 
    x:Class="WinRTDbQuickStart.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:WinRTDbQuickStart"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d"
    d:DesignHeight="768" d:DesignWidth="1366">
    <UserControl.Resources>

    </UserControl.Resources>

    <Grid x:Name="LayoutRoot" Background="#FF0C0C0C">
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition Height="30"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="2*"/>
                <ColumnDefinition Width="1*"/>
            </Grid.ColumnDefinitions>
            <TextBlock Text="People"/>
            <ListBox 
            Name="MainList"
            Grid.Row="1"
            HorizontalAlignment="Stretch" 
            VerticalAlignment="Stretch"
            ItemsSource="{Binding People}" 
            SelectedItem="{Binding Path=SelectedPerson, Mode=TwoWay}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Vertical">
                            <TextBlock Text="{Binding Path=LastName}" FontSize="14"/>
                            <TextBlock Text="{Binding Path=FirstName}" FontSize="12"/>
                            <TextBlock Text="{Binding Path=Age}" FontSize="10"/>
                        </StackPanel>

                    </DataTemplate>
                </ListBox.ItemTemplate>

            </ListBox>
            <Grid 
            Grid.Row="1" 
            Grid.Column="1">

                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                </Grid.RowDefinitions>
                <TextBlock Text="Last Name" HorizontalAlignment="Right" VerticalAlignment="Center"/>
                <TextBlock Text="First Name" Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Center"/>
                <TextBlock Text="Age" Grid.Row="2" HorizontalAlignment="Right" VerticalAlignment="Center"/>

                <TextBox Text="{Binding Path=SelectedPerson.LastName, Mode=TwoWay}" FontSize="14" Grid.Column="1"/>
                <TextBox Text="{Binding Path=SelectedPerson.FirstName, Mode=TwoWay}" FontSize="12" Grid.Column="1" Grid.Row="1"/>
                <TextBox Text="{Binding Path=SelectedPerson.Age, Mode=TwoWay}" FontSize="10" Grid.Column="1" Grid.Row="2"/>
                <StackPanel Grid.Row="3" Grid.Column="1" >
                    <Button Content="Delete" 
                    Command="{Binding Path=DeleteCommand}" CommandParameter="{Binding SelectedPerson}"/>
                    <Button Content="Save" 
                    Command="{Binding Path=SaveCommand}" />
                </StackPanel>

            </Grid>
        </Grid>
        <AppBar HorizontalContentAlignment="Stretch" Height="88" VerticalContentAlignment="Stretch" VerticalAlignment="Bottom">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <StackPanel Orientation="Horizontal">
                    <Button Style="{StaticResource AddAppBarButtonStyle}" Command="{Binding Path=AddCommand}"/>
                </StackPanel>
            </Grid>
        </AppBar>
    </Grid>
</Page>